﻿using System;
using TSharp.Core.Util;

namespace TSharp.Core.Authentication.Facade
{
    /// <summary>
    /// 数据票证签名服务
    /// <para>2010/8/4</para>
    /// 	<para>TANGJINGBO</para>
    /// 	<para>tangjingbo</para>
    /// </summary>
    public interface ITokenService
    {
        /// <summary>
        /// 生成一个针对url的有时效的签名(使用长整型区间限制签名有效区间)
        /// </summary>
        /// <param name="url">The URL.</param>
        /// <param name="start">The start.</param>
        /// <param name="end">The end.</param>
        /// <returns></returns>
        ParameterizedUri GetTokenUrl(ParameterizedUri url, long start, long end);

        /// <summary>
        /// 验证一个用户名的签名url是否有效(使用长整型区间限制签名有效区间)
        /// </summary>
        /// <param name="url">The URL.</param>
        /// <param name="current">The current UTC file time.</param>
        /// <returns></returns>
        bool ValidateTokenUrl(ParameterizedUri url, long current);


        /// <summary>
        /// 生成一个针对url的有时效的签名(使用时间区间限制签名有效区间).
        /// </summary>
        /// <param name="url">被签名url</param>
        /// <param name="startUtcTime">The start UTC time.</param>
        /// <param name="endUtcTime">The end UTC time.</param>
        /// <returns></returns>
        ParameterizedUri GetTokenUrl(ParameterizedUri url, DateTime startUtcTime, DateTime endUtcTime);

        /// <summary>
        /// 验证一个用户名的签名url是否有效(使用时间区间限制签名有效区间)
        /// </summary>
        /// <param name="url">待验证url</param>
        /// <param name="currentUtcTime">The current UTC time.</param>
        /// <returns></returns>
        bool ValidateTokenUrl(ParameterizedUri url, DateTime currentUtcTime);
    }
}